home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / gutenprint / printers.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-03-15  |  8.0 KB  |  252 lines

  1. /*
  2.  * "$Id: printers.h,v 1.3.8.1 2007/12/15 20:35:35 rlk Exp $"
  3.  *
  4.  *   libgimpprint printer functions.
  5.  *
  6.  *   Copyright 1997-2000 Michael Sweet (mike@easysw.com) and
  7.  *    Robert Krawitz (rlk@alum.mit.edu)
  8.  *
  9.  *   This program is free software; you can redistribute it and/or modify it
  10.  *   under the terms of the GNU General Public License as published by the Free
  11.  *   Software Foundation; either version 2 of the License, or (at your option)
  12.  *   any later version.
  13.  *
  14.  *   This program is distributed in the hope that it will be useful, but
  15.  *   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  16.  *   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  17.  *   for more details.
  18.  *
  19.  *   You should have received a copy of the GNU General Public License
  20.  *   along with this program; if not, write to the Free Software
  21.  *   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22.  */
  23.  
  24. /**
  25.  * @file gutenprint/printers.h
  26.  * @brief Printer functions.
  27.  */
  28.  
  29. #ifndef GUTENPRINT_PRINTERS_H
  30. #define GUTENPRINT_PRINTERS_H
  31.  
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35.  
  36. #include <gutenprint/string-list.h>
  37. #include <gutenprint/list.h>
  38. #include <gutenprint/vars.h>
  39.  
  40. /**
  41.  * The printer type represents a printer model.  A particular
  42.  * printer model must selected in order to be able to print.  Each
  43.  * printer model provides default print options through a default
  44.  * vars object.
  45.  *
  46.  * @defgroup printer printer
  47.  * @{
  48.  */
  49.  
  50. struct stp_printer;
  51. /** The printer opaque data type (representation of printer model). */
  52. typedef struct stp_printer stp_printer_t;
  53.  
  54. /**
  55.  * Get the number of available printer models.
  56.  * @returns the number of printer models.
  57.  */
  58. extern int stp_printer_model_count(void);
  59.  
  60. /**
  61.  * Get a printer model by its index number.
  62.  * @param idx the index number.  This must not be greater than (total
  63.  * number of printers - 1).
  64.  * @returns a pointer to the printer model, or NULL on failure.  The
  65.  * pointer should not be freed.
  66.  */
  67. extern const stp_printer_t *stp_get_printer_by_index(int idx);
  68.  
  69. /**
  70.  * Get a printer model by its long (translated) name.
  71.  * @param long_name the printer model's long (translated) name.
  72.  * @returns a pointer to the printer model, or NULL on failure.  The
  73.  * pointer should not be freed.
  74.  */
  75. extern const stp_printer_t *stp_get_printer_by_long_name(const char *long_name);
  76.  
  77. /**
  78.  * Get a printer model by its short name.
  79.  * @param driver the printer model's short (driver) name.
  80.  * @returns a pointer to the printer model, or NULL on failure.  The
  81.  * pointer should not be freed.
  82.  */
  83. extern const stp_printer_t *stp_get_printer_by_driver(const char *driver);
  84.  
  85. /**
  86.  * Get the printer model from a vars object.
  87.  * @param v the vars to use.
  88.  * @returns a pointer to the printer model, or NULL on failure.  The
  89.  * pointer should not be freed.
  90.  */
  91. extern const stp_printer_t *stp_get_printer(const stp_vars_t *v);
  92.  
  93. /**
  94.  * Get the printer index number from the printer model short (driver) name.
  95.  * @deprecated There should never be any need to use this function.
  96.  * @param driver the printer model's short (driver) name.
  97.  * @returns the index number, or -1 on failure.
  98.  */
  99. extern int stp_get_printer_index_by_driver(const char *driver);
  100.  
  101. /**
  102.  * Get a printer model's long (translated) name.
  103.  * @param p the printer model to use.
  104.  * @returns the long name (should never be freed).
  105.  */
  106. extern const char *stp_printer_get_long_name(const stp_printer_t * p);
  107.  
  108. /**
  109.  * Get a printer model's short (driver) name.
  110.  * @param p the printer model to use.
  111.  * @returns the short name (should never be freed).
  112.  */
  113. extern const char *stp_printer_get_driver(const stp_printer_t *p);
  114.  
  115. /**
  116.  * Get a printer model's family name.
  117.  * The family name is the name of the modular "family" driver this
  118.  * model uses.
  119.  * @param p the printer model to use.
  120.  * @returns the family name (should never be freed).
  121.  */
  122. extern const char *stp_printer_get_family(const stp_printer_t *p);
  123.  
  124. /**
  125.  * Get a printer model's manufacturer's name.
  126.  * @param p the printer model to use.
  127.  * @returns the manufacturer's name (should never be freed).
  128.  */
  129. extern const char *stp_printer_get_manufacturer(const stp_printer_t *p);
  130.  
  131. /**
  132.  * Get a printer model's model number.
  133.  * The model number is used internally by the "family" driver module,
  134.  * and has no meaning out of that context.  It bears no relation to
  135.  * the model name/number actually found on the printer itself.
  136.  * @param p the printer model to use.
  137.  * @returns the model number.
  138.  */
  139. extern int stp_printer_get_model(const stp_printer_t *p);
  140.  
  141. /**
  142.  * Get the default vars for a particular printer model.
  143.  * The default vars should be copied to a new vars object and
  144.  * customised prior to printing.
  145.  * @param p the printer model to use.
  146.  * @returns the printer model's default vars.
  147.  */
  148. extern const stp_vars_t *stp_printer_get_defaults(const stp_printer_t *p);
  149.  
  150. /**
  151.  * Set a vars object to use a particular driver, and set the parameter
  152.  * to its defaults.
  153.  * @param v the vars to use.
  154.  * @param p the printer model to use.
  155.  */
  156. extern void stp_set_printer_defaults(stp_vars_t *v, const stp_printer_t *p);
  157.  
  158.  
  159. /**
  160.  * Print the image.
  161.  * @warning stp_job_start() must be called prior to the first call to
  162.  * this function.
  163.  * @param v the vars to use.
  164.  * @param image the image to print.
  165.  * @returns 0 on failure, 1 on success, 2 on abort requested by the
  166.  * driver.
  167.  */
  168. extern int stp_print(const stp_vars_t *v, stp_image_t *image);
  169.  
  170. /**
  171.  * Start a print job.
  172.  * @warning This function must be called prior to the first call to
  173.  * stp_print().
  174.  * @param v the vars to use.
  175.  * @param image the image to print.
  176.  * @returns 1 on success, 0 on failure.
  177.  */
  178. extern int stp_start_job(const stp_vars_t *v, stp_image_t *image);
  179.  
  180. /**
  181.  * End a print job.
  182.  * @param v the vars to use.
  183.  * @param image the image to print.
  184.  * @returns 1 on success, 0 on failure.
  185.  */
  186. extern int stp_end_job(const stp_vars_t *v, stp_image_t *image);
  187.  
  188. /**
  189.  * Retrieve options that need to be passed to the underlying print
  190.  * system.
  191.  * @param v the vars to use.
  192.  * @returns list of options in a string list ('name' is the name
  193.  * of the option; 'text' is the value it takes on).  NULL return means
  194.  * no external options are required.  User must stp_string_list_destroy
  195.  * the list after use.
  196.  */
  197. extern stp_string_list_t *stp_get_external_options(const stp_vars_t *v);
  198.  
  199. typedef struct
  200. {
  201.   stp_parameter_list_t (*list_parameters)(const stp_vars_t *v);
  202.   void  (*parameters)(const stp_vars_t *v, const char *name,
  203.               stp_parameter_t *);
  204.   void  (*media_size)(const stp_vars_t *v, int *width, int *height);
  205.   void  (*imageable_area)(const stp_vars_t *v,
  206.               int *left, int *right, int *bottom, int *top);
  207.   void  (*maximum_imageable_area)(const stp_vars_t *v, int *left, int *right,
  208.                   int *bottom, int *top);
  209.   void  (*limit)(const stp_vars_t *v, int *max_width, int *max_height,
  210.                  int *min_width, int *min_height);
  211.   int   (*print)(const stp_vars_t *v, stp_image_t *image);
  212.   void  (*describe_resolution)(const stp_vars_t *v, int *x, int *y);
  213.   const char *(*describe_output)(const stp_vars_t *v);
  214.   int   (*verify)(stp_vars_t *v);
  215.   int   (*start_job)(const stp_vars_t *v, stp_image_t *image);
  216.   int   (*end_job)(const stp_vars_t *v, stp_image_t *image);
  217.   stp_string_list_t *(*get_external_options)(const stp_vars_t *v);
  218. } stp_printfuncs_t;
  219.  
  220. typedef struct stp_family
  221. {
  222.   const stp_printfuncs_t *printfuncs;   /* printfuncs for the printer */
  223.   stp_list_t             *printer_list; /* list of printers */
  224. } stp_family_t;
  225.  
  226. extern int stp_get_model_id(const stp_vars_t *v);
  227.  
  228. extern int stp_verify_printer_params(stp_vars_t *v);
  229.  
  230. extern int stp_family_register(stp_list_t *family);
  231. extern int stp_family_unregister(stp_list_t *family);
  232. extern void stp_initialize_printer_defaults(void);
  233.  
  234. extern stp_parameter_list_t stp_printer_list_parameters(const stp_vars_t *v);
  235.  
  236. extern void
  237. stp_printer_describe_parameter(const stp_vars_t *v, const char *name,
  238.                    stp_parameter_t *description);
  239.  
  240. const char *stp_describe_output(const stp_vars_t *v);
  241.  
  242. /** @} */
  243.  
  244. #ifdef __cplusplus
  245.   }
  246. #endif
  247.  
  248. #endif /* GUTENPRINT_PRINTERS_H */
  249. /*
  250.  * End of "$Id: printers.h,v 1.3.8.1 2007/12/15 20:35:35 rlk Exp $".
  251.  */
  252.